# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=lol-html
pkgver=1.1.1
pkgrel=0
pkgdesc="Low output latency streaming HTML parser/rewriter (C library)"
url="https://crates.io/crates/lol-html"
arch="all"
license="BSD-3-Clause"
depends_dev="$pkgname=$pkgver-r$pkgrel"
makedepends="
	cargo
	cargo-auditable
	"
subpackages="$pkgname-dev"
source="
	https://github.com/cloudflare/lol-html/archive/v$pkgver/lol-html-$pkgver.tar.gz
	lol-html.pc.in

	lockfile.patch
	"
builddir="$srcdir/lol-html-$pkgver/c-api"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
	(
		cd tests
		cargo fetch --target="$CTARGET" --locked
	)
}

build() {
	cargo auditable build --frozen --release

	sed 's/@VERSION@/'"$pkgver"'/' "$srcdir"/lol-html.pc.in > lol-html.pc
}

check() {
	# why is this a separate crate?
	cd tests
	cargo test --frozen
}

package() {
	install -Dm755 target/release/liblolhtml.so -t "$pkgdir"/usr/lib/
	install -Dm644 include/lol_html.h -t "$pkgdir"/usr/include/
	install -Dm644 lol-html.pc -t "$pkgdir"/usr/lib/pkgconfig/
}

sha512sums="
5cf78d7f602018e22642fbba0bbf0a84fc17dc218f5e60d77f2c0f08c7d5bd6e378487372e40a2a3a02c7729ae6a24d128130fa702e597335e9a9e860f60cce1  lol-html-1.1.1.tar.gz
21772f891c68c8d6970c35d0c0fc920c00bd61bc075adcb72fa9479b340ea020f8d112832c6dba41f5e96cb03245587c3ffd518341ee7bb154ccebf7535e691c  lol-html.pc.in
e92b9e841e3db4c3fe8cf8132ca85317dfaf0dd072d34146e6249050b0165d1130f190d1646962ec406fcc7d27936a9d47018aadda02132b38cefe9c53c0fc5f  lockfile.patch
"
